package draw_0724;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;

public class ui {
    public void drawui(){
        JFrame jf = new JFrame();
        jf.setTitle ("画笔");
        jf.setSize(1000,1000);
        jf.setLocationRelativeTo(null);
        jf.setDefaultCloseOperation(3);

        FlowLayout flow=new FlowLayout();
        jf.setLayout(flow);
        JButton jbu1=new JButton("直线");
        JButton jbu2=new JButton("三角形");
        jf.add(jbu1);
        jf.add(jbu2);


        jf.setVisible(true);

        Graphics g=jf.getGraphics();

        draw mouse=new draw();
        jf.addMouseListener(mouse);
        jbu1.addActionListener(mouse);
        jbu2.addActionListener(mouse);

        mouse.gr=g;




    }

    public static void main(String[] args) {
        ui a=new ui();
        a.drawui();


    }
}
